home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3 / standard / gamma.z / gamma
Encoding:
Text File  |  2002-10-03  |  4.8 KB  |  102 lines

  1. GAMMA(3M)                                              Last changed: 2-2-99
  2.  
  3.  
  4. NNAAMMEE
  5.      llggaammmmaa, ggaammmmaa, llggaammmmaall, ggaammmmaall - log gamma function
  6.  
  7. SSYYNNOOPPSSIISS
  8.      ##iinncclluuddee <<mmaatthh..hh>>
  9.  
  10.      ddoouubbllee ggaammmmaa((ddoouubbllee _x));;
  11.      ddoouubbllee llggaammmmaa((ddoouubbllee _x));;
  12.      lloonngg ddoouubbllee ggaammmmaall((lloonngg ddoouubbllee _x));;
  13.      lloonngg ddoouubbllee llggaammmmaall((lloonngg ddoouubbllee _x));;
  14.  
  15.      eexxtteerrnn iinntt ssiiggnnggaamm;;
  16.      eexxtteerrnn iinntt ssiiggnnggaammll;;
  17.  
  18. IIMMPPLLEEMMEENNTTAATTIIOONN
  19.      IRIX systems
  20.  
  21. DDEESSCCRRIIPPTTIIOONN
  22.      llggaammmmaa and ggaammmmaa return llnn||GGAAMMMMAA((_x))|| where GAMMA is the mathematical
  23.      gamma function.
  24.  
  25.      ggaammmmaall and llggaammmmaall are the long double versions of the lloogg ggaammmmaa
  26.      function.
  27.  
  28.      ggaammmmaa and llggaammmmaa are identical, as are ggaammmmaall and llggaammmmaall.
  29.  
  30.      The external integer ssiiggnnggaamm returns the sign of GGAAMMMMAA((_x)), and the
  31.      external integer ssiiggnnggaammll returns the sign of GGAAMMMMAALL((_x)).
  32.  
  33. NNOOTTEESS
  34.      Do _n_o_t use the following expression to compute gg ::==GGAAMMMMAA((_x)):
  35.  
  36.           signgam * exp(gamma(x))
  37.  
  38.      Instead, use a program similar to the following (in C):
  39.  
  40.           lg = gamma(x); g = signgam*exp(lg);
  41.  
  42.      Only after ggaammmmaa has returned can ssiiggnnggaamm be correct.  Note too that
  43.      GGAAMMMMAA((_x)) must overflow when _x is large enough, and is undefined when _x
  44.      is a nonpositive integer.
  45.  
  46.      Analogous rules apply to ggaammmmaall and ssiiggnnggaammll.
  47.  
  48.      The following C program fragment might be used to calculate GG if the
  49.      overflow needs to be detected:
  50.  
  51.            if ((y = gamma(x)) > LN_MAXDOUBLE)
  52.                    error();
  53.            y = signgam * exp(y);
  54.  
  55.      where LLNN__MMAAXXDDOOUUBBLLEE is the least value that causes eexxpp to overflow and
  56.      is defined in the <<vvaalluueess..hh>> header file.
  57.  
  58.      The name GGAAMMMMAA was attached to llnn GG only in the UNIX math library for
  59.      C.   Elsewhere (in some FORTRAN libraries) the name GGAAMMMMAA belongs to GG
  60.      and the name AALLGGAAMMMMAA to llnn GG in single precision;  in double
  61.      precision, the usual names are DDGGAAMMMMAA and DDLLGGAAMMMMAA in FORTRAN.
  62.  
  63.      ggaammmmaa in C originally delivered  llnn((GG((xx)))).  Later, the program ggaammmmaa
  64.      was changed to handle negative arguments in a more conventional way.
  65.      The most recent changes correct inaccurate values when _x is almost a
  66.      negative integer.
  67.  
  68.      Some math libraries have changed the name of this function to llggaammmmaa(())
  69.      to suggest its real functionality.
  70.  
  71.      On SGI systems, the name ggaammmmaa is currently maintained as a synonym to
  72.      llggaammmmaa for compatibility.
  73.  
  74.      llggaammmmaa and ggaammmmaa are not ANSI-C functions.  If you compile with the
  75.      --aannssii or --aannssiippoossiixx options, you must supply your own prototypes for
  76.      these functions or you will get incorrect results.  (See the
  77.      prototypes defined in //uussrr//iinncclluuddee//mmaatthh..hh).
  78.  
  79. RREETTUURRNN VVAALLUUEESS
  80.      Functions in the standard math library lliibbmm..aa, are referred to as --llmm
  81.      versions.  Those in math library lliibbmmxx..aa are referred to as --llmmxx
  82.      versions. Those in the the BSD math library lliibbmm4433..aa are referred to
  83.      as --llmm4433 versions.  The --llmm and --llmmxx versions always return the
  84.      default Quiet NaN and set _e_r_r_n_o to EDOM when a NaN is used as an
  85.      argument.  A NaN argument usually causes the --llmm4433 versions to return
  86.      the same argument.  The --llmm4433 versions never set _e_r_r_n_o. The value of
  87.      HHUUGGEE__VVAALL is IEEE Infinity.
  88.  
  89.      The ggaammmmaa functions return HHUUGGEE__VVAALL when the argument is zero or a
  90.      negative integer. The --llmm and --llmmxx versions also set eerrrrnnoo to EDOM.
  91.  
  92.      When the correct value would overflow, the ggaammmmaa functions return
  93.      HHUUGGEE__VVAALL.  The --llmm and --llmmxx versions also set _e_r_r_n_o to ERANGE.
  94.  
  95.      See mmaatthheerrrr(3M) for a description of error handling for --llmmxx
  96.      functions.
  97.  
  98. SSEEEE AALLSSOO
  99.      mmaatthh(3M), mmaatthheerrrr(3M)
  100.  
  101.      This man page is available only online.
  102.